var dom = require('dom');
var Emitter = require('emitter');
var Element = require('./element');

function Scene(backgroundColor) {
  Emitter.call(this);

  this.el = document.createElement('div');
  dom(this.el).css({
    'position': 'absolute',
    'overflow': 'hidden',
    'backgroundColor': backgroundColor || 'white'
  });
}

Scene.prototype = new Emitter();

Scene.prototype.fullscreen = function() {
  dom(this.el).css({
    width: window.innerWidth,
    height: window.innerHeight
  });
};

Scene.prototype.add = function(elem) {
  if (elem instanceof Element) {
    dom(this.el).append(elem.el);
  } else {
    dom(this.el).append(elem);
  }
};

module.exports = Scene;
